using System.Windows.Input;
using UserManager.Commands;
using UserManager.Models;

namespace UserManager.ViewModel;

public class AddUserViewModel
{
    public ICommand AddUserCommand { get; set; }
    
    public string? Name { get; set; }
    public string? Email { get; set; }

    public AddUserViewModel()
    {
        AddUserCommand = new RelayCommand(AddUser, CanAddUser);
    }

    private bool CanAddUser(object obj)
    {
        return true;
    }

    private void AddUser(object obj)
    {
        UserManagerRep.AddUser(new User
        {
            Name = Name,
            Email = Email
        });
    }
}